import { Routes } from '@angular/router';
import { startPageGuard } from '@core';
import { authSimpleCanActivate, authSimpleCanActivateChild } from '@delon/auth';

import { DashboardComponent } from './dashboard/dashboard.component';
import { ShareComponent } from './share/share.component';
import { TeamComponent } from './team/team.component';
import { FileComponent } from './types/file.component';
import { ImageComponent } from './types/image.component';
import { SoundComponent } from './types/sound.component';
import { UnknownComponent } from './types/unknown.component';
import { VideoComponent } from './types/video.component';
import { ZipComponent } from './types/zip.component';
import { UserComponent } from './user/user.component';
import { LayoutBasicComponent } from '../layout';

export const routes: Routes = [
  {
    path: '',
    component: LayoutBasicComponent,
    canActivate: [startPageGuard, authSimpleCanActivate],
    canActivateChild: [authSimpleCanActivateChild],
    data: {},
    children: [
      { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
      { path: 'dashboard', component: DashboardComponent },
      { path: 'image', component: ImageComponent, data: { title: '图片' } },
      { path: 'sound', component: SoundComponent, data: { title: '音频' } },
      { path: 'video', component: VideoComponent, data: { title: '视频' } },
      { path: 'file', component: FileComponent, data: { title: '文档' } },
      { path: 'zip', component: ZipComponent, data: { title: '压缩文件' } },
      { path: 'unknown', component: UnknownComponent, data: { title: '其他' } },
      { path: 'share', component: ShareComponent, data: { title: '共享柜' } },
      { path: 'team', component: TeamComponent, data: { title: '组文件' } },
      { path: 'user', component: UserComponent, data: { title: '用户与组' } }
    ]
  },
  // passport
  { path: '', loadChildren: () => import('./passport/routes').then(m => m.routes) },
  { path: 'exception', loadChildren: () => import('./exception/routes').then(m => m.routes) },
  { path: '**', redirectTo: 'exception/404' }
];
